*********************************************************************************
/*    Show change in audit probability and expenditures, by income 		*/
*********************************************************************************
clear all

* File paths
local datapath "${mvpf_audits}/data/cleaned" 
local graphpath "${graphpath}" 
local dofilepath "${mvpf_audits}/code/prep" 

* Version of fig to produce 
global version ${version} // paper or slides

* Other formatting
if "${version}" == "slides" {
	global title "title(" ", size(vhuge))"
	global img wmf
	graph set window fontface "Arial"
	global title "title(" ", size(vhuge))"
	global axis_size "" //xsize(6.5) ysize(4)" // makes figure wider
}

else if "${version}" == "paper" {
	global title "title("")"
	global img pdf
	graph set window fontface "LMRoman10-Regular"
	global title " "
	global axis_size " " // makes figure wider
}	

use "${mvpf_audits}/data/figures_rep/figure_4b.dta", clear

	local fig_name = "bar_roc_exp_inc"
	local ylab = "Change in Total Expenditures 2010-2014 (%)"
	local lb = -60
	local ub = 0 // round(`rev_tot_`hetlab''*1.13, 10) 
	local int = 10 //(`ub' - `lb')/5
	
* Ops audit rates
tw  (bar roc tpi_pctl, barwidth(0.8)  lcolor(%0) color(gs11) ) ///	
	(function y =0, lcolor(gs11) lwidth(thin) lp(solid) range(0.3 22.7)) ///
	, ///
	ytitle("`ylab'", size(3)) yscale(r(`lb_f' `ub_f') ) ///
	ylabel(`lb'(`int')`ub', nogrid format(%09.0fc) ) ///
	///text(-55 12 "Audit type: In-Person") ///
	legend(off) ///
	${title} ${axis_size} ///
	xscale(r()) xtitle("TPI Percentile Group") ///
	xlabel(1(1)22, value labsize(small) tl(.5) nogrid angle(45) )  
graph export "`graphpath'/`fig_name'.wmf", as(wmf) replace
	
